This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Jul 25, 2016, 4:52 PM
3 Posts

Multiple attachments removed while saving MIME format notes document

  • Category: Mail
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: MIME,attachments,writetext,setcontentastext,lotusscript,mail attachment save,content-disposition
  • Replies: 4

I am facing a very weird issue.

I wish to convert one mail of MIME format into .eml file with all the mail content (i.e. headers, text and attachments).

While doing so only first attachment of MIME mail is only available in my new .eml file, I am creating.

I think that while saving the document only first MIME attachment is coming..

Code snippet :-

'

Set nBody = newEmailCopyDoc.CreateMIMEEntity
    Set nBodyChild = nBody.CreateChildEntity()

'

'.....

Call nStream.Writetext(sMailText)    

(In above line sMailText contains all the content of MIME mail for which I am generating .eml file . I checked using debugging that 'sMailText' it contains all the attachments content)

Call nBodyChild.SetContentFromText(nStream, "text/plain", ENC_IDENTITY_8BIT)

Later on I am saving my mail 

Call newEmailCopyDoc.save(True,False)    

---------------------------------------------------------------------------------------

But in output when I check newly generated eml file..it contains only 1 attachments , trimming all other attachments. 

PLEASE HELP !!

Jul 25, 2016, 5:54 PM
323 Posts
This is totally off the wall ...

I dunno how your MIME email was constructed, but y'might check whether the number of the MIMEPart is different on each entity.

I once wrote some code creating MIME emails, and it seemed to work swimmingly in Notes.

Then when it went to Outlook, Outlook went haywire, splitting up MIME parts, and unable to access MIME parts all over.

I traced it to breaking the email into MIME parts at points where "Outlook didn't like it", and naming them all the same thing.

Jul 26, 2016, 7:53 AM
3 Posts
Multiple attachments removed while saving MIME format notes document

Thanks Mike for your response.

But I checked the MIME parts and all other parts are working perfectly fine for ex : inline attachments, text etc.

But When I save notes document with the picked MIME content , it only saves one attachment (i.e. $ file ) and removed other attachments.

 

Not sure why it is happening.

 

 

Jul 26, 2016, 1:17 PM
103 Posts
May help..

I dug this out from something I did recently which may help....

 

    Dim body As NotesMIMEEntity 
    Dim bodyChild As NotesMIMEEntity
    Dim header As NotesMIMEHeader 
    Dim stream As NotesStream 
    Dim docMemo As NotesDocument

    Set docMemo = dbMailBox.Createdocument() 'creating mail in the mail box

    session.ConvertMIME = False ' Do not convert MIME to rich text 
    Set stream = session.CreateStream 
    Set body = docMemo.CreateMIMEEntity
    Set bodyChild = body.Createchildentity()
    Set header = bodyChild.createHeader("Content-Type")    
    Call header.setHeaderVal("text/htm")         
    Call stream.Open("c:\\temp\\ReportName.html") 'Just importing the body of the email here in html format, also attaching it as a file later
    Call bodyChild.SetContentFromText(stream, "text/HTML;charset=UTF-8", ENC_IDENTITY_7BIT) 

    **Attachment 1**
    Set bodyChild = body.Createchildentity()
    Set header = bodyChild.createHeader("Content-Type")
    Call header.setHeaderVal("multipart/mixed")    
    Set header = bodyChild.createHeader("Content-Disposition")
    Call header.setHeaderVal("attachment; filename=fileName.csv")
    Set header = bodyChild.createHeader("Content-ID")
    Call header.setHeaderVal("fileName.csv")
    Set stream = session.CreateStream
    Call stream.Open("c:\\temp\\fileName.csv")
    Call bodyChild.SetContentFromBytes(stream, "application/csv", ENC_IDENTITY_BINARY)    

    **Attachment 2**
    Set bodyChild = body.Createchildentity()
    Set header = bodyChild.createHeader("Content-Type")
    Call header.setHeaderVal("multipart/mixed")    
    Set header = bodyChild.createHeader("Content-Disposition")
    Call header.setHeaderVal("attachment; filename=ReportName.html")
    Set header = bodyChild.createHeader("Content-ID")
    Call header.setHeaderVal("ReportName.html")
    Set stream = session.CreateStream
    Call stream.Open("c:\\temp\\ReportName.html")
    Call bodyChild.SetContentFromBytes(stream, "text/HTML", ENC_IDENTITY_BINARY)

    Call docMemo.Save(True, False)

Jul 27, 2016, 1:12 PM
3 Posts
attachhing from drive whereas I would like to have it from another mail

Thanks D porter for piece of code and suggestions.

But again in your code you are uploading attachments from c drive whereas I already have one notes email (with multiple attachments) and I wish to convert that notes mail into file.


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal